export default {
	namespaced: true,
	state: {
		userInfoBox: {
			show: false,
			user: null,
			pos: {
				x: 0,
				y: 0
			}
		},
		fullImage: {
			show: false,
			url: null
		},
		userSetting: {
			show: false
		}
	},
	mutations: {
		showUserInfoBox(state, user) {
			state.userInfoBox.show = true;
			state.userInfoBox.user = user;
			let w = document.documentElement.clientWidth;
			let h = document.documentElement.clientHeight;
			state.userInfoBox.pos.x = Math.min(user.pos?.x || 0, w - 350);
			state.userInfoBox.pos.y = Math.min(user.pos?.y || 0, h - 200);
		},
		closeUserInfoBox(state) {
			state.userInfoBox.show = false;
			state.userInfoBox.user = null;
		},
		showFullImageBox(state, url) {
			state.fullImage.show = true;
			state.fullImage.url = url;
		},
		closeFullImageBox(state) {
			state.fullImage.show = false;
			state.fullImage.url = null;
		},
		showUserSetting(state, show) {
			state.userSetting.show = show;
		}
	}
}